<?php
return CMap::mergeArray(
    require(dirname(__FILE__).'/main.php'),
    array(
        // Put front-end settings there
        // (for example, url rules).
        'components' => array(
            'user' => array(
                "loginUrl"=>array("account/index"),
                // enable cookie-based authentication
                'allowAutoLogin' => true,
            ),
            // uncomment the following to enable URLs in path-format
            'urlManager'=>array(
                'urlFormat'=>'path',
                'showScriptName'=>false,
                'rules'=>array(
                    //My URL
                    'dang-nhap'=>array('account/index','urlSuffix'=>'.html'),

                    'SanPham'=>array('product/index'),
                    'SanPham/<category:\d+>/<urlMapping:[\w-]+>/page-<page:\d+>'=>array('product/search','urlSuffix'=>'.html', 'caseSensitive'=>false),
                    'SanPham/<sSearch:[\w-]+>/page-<page:\d+>'=>array('product/search','urlSuffix'=>'.html', 'caseSensitive'=>false),
                    'SanPham/<key:\d+>/<urlMapping:[\w-]+>'=>array('product/detail','urlSuffix'=>'.html', 'caseSensitive'=>false),

                    '<categoryUrl:[\w-]+>/<articleId:\d+>/<articleUrl:[\w-]+>'=>array('article/index','urlSuffix'=>'.html', 'caseSensitive'=>false),
                    //'<categoryUrl:[\w-]+>/'=>array('article/index','defaultParams'=>array('articleUrl'=>'gioi-thieu'), ),

                    '<controller:\w+>/<id:\d+>'=>'<controller>/view',
                    '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
                    '<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
                ),
            ),
            /*'db' => array(
                'connectionString' => 'sqlite:' . dirname(__FILE__) . '/../data/testdrive.db',
            ),*/
            // uncomment the following to use a MySQL database
            
            'db'=>array(
                'connectionString' => 'mysql:host=localhost;dbname=onlineshopping',
                'emulatePrepare' => true,
                'enableProfiling'=>true,
                'enableParamLogging' => true,
                'username' => 'root',
                'password' => '',
                'charset' => 'utf8',
            ),
             
            'errorHandler' => array(
                // use 'site/error' action to display errors
                'errorAction' => 'site/error',
            ),
            'log' => array(
                'class' => 'CLogRouter',
                'routes' => array(
                    array(
                        'class' => 'CFileLogRoute',
                        'levels'=>'trace, info, error, warning',
                    ),
                    // uncomment the following to show log messages on web pages
                    /*array(
                        'class' => 'CWebLogRoute',
                        'levels'=>'trace, info, error, warning',
                    ),*/
                ),
            ),
        )
    )
);
?>